<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript" src="<s:url value="/js/safety.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery/jquery.collapse.js"/>"></script>

<s:form id="formEdit" cssClass="tableEdit"  method="POST" enctype="multipart/form-data" action="send">

    <tr>
        <th colspan="4" class="tableTitle">
            <h5>Safety Documents</h5>
        </th>
    </tr>

    <s:select label="Drug" name="safetydocs.droga.id" id="droga"  value="%{safetydocs.droga.id}"
              headerKey="-1" headerValue="Choose Drug"
              list="drogaList"
              listKey="id"
              listValue="drugName"
            >
    </s:select>

    <s:select label="Countries" name="paisesElegidos" id="countries" multiple="true" value="%{paisesElegidos}"
              headerKey="-1" headerValue="Choose Countries"
              list="paisList"
              listKey="id"
              listValue="country"
              style="height: 110px"
            >
    </s:select>

    <s:select label="To" name="rolesElegidos" id="roles" multiple="true"  value="%{rolesElegidos}"
              headerKey="-1" headerValue="Choose Roles"
              list="rolList"
              listKey="id"
              listValue="descripcion"
              style="height: 100px"
            >
    </s:select>

    <tr>
        <td colspan="2">
        <div id="attachments-show-hide" class="collapseSeparacion">
        <h2 style="background-color: #00579C; width: 100%">Attachments</h2>
        <div>
        <table id="table_body" class="tableEditFixed">
            <col width="125px" />
            <col width="155px" />
            <s:hidden name="safetydocs.envioses[0].type" value="Body"/>
            <tr>
                <td>
                    <label>Body Attachment:</label>
                </td>
                <td>
                    <s:file name="files" id="bodyAttachment" value="%{files}" theme="simple" cssClass="req"/>
                </td>
            </tr>
            <s:textarea label="Body comment" name="safetydocs.envioses[0].comment" id="bodyComment" style="height: 80px" />
            <s:hidden id="cant" value="1"></s:hidden>
            <s:hidden id="ultimoId" value="1"></s:hidden>
        </table>


    <TABLE id="table_docs" class="tableEditFixed" style="margin-top: 0px;">
        <col width="125px" />
        <col width="155px" />
        <TR id="docType1">
            <TD>
                <label>Document type:</label>
            </td>
            <td>
                <s:select name="safetydocs.envioses[1].type" id="docTypeCell1"  value="%{safetydocs.envioses[1].type}"
                          headerKey="" headerValue="Choose Type"
                          list="tiposDocumentos"
                          listKey="type"
                          listValue="type"
                          cssClass="req"
                          theme="simple"
                          onchange="showTypeFields(this);"
                        >
                </s:select>
            </td>
        </TR>
        <TR id="receivedBms1">
            <TD>
                <label>Received BMS:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].receivedBms" id="receivedBmsCell1" theme="simple" value="%{safetydocs.envioses[1].receivedBms}" cssClass="datepickerReq"/>
            </TD>
        </TR>
        <TR id="docTypeCell1event" class="ocultos">
            <TD>
                <label>Event:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].event" id="eventCell1" theme="simple" value="%{safetydocs.envioses[1].event}" cssClass="req"/>
            </TD>
        </TR>
        <TR id="docTypeCell1revisionDate" class="ocultos">
            <TD>
                <label>Revision Date:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].revisionDate" id="revisionDateCell1" theme="simple" value="%{safetydocs.envioses[1].revisionDate}" cssClass="datepickerReq"/>
            </TD>
        </TR>
        <TR id="docTypeCell1processedDate" class="ocultos">
            <TD>
                <label>Processed Date:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].processedDate" id="processedDateCell1" theme="simple" value="%{safetydocs.envioses[1].processedDate}" cssClass="datepickerReq"/>
            </TD>
        </TR>
        <TR id="docTypeCell1controlNumber" class="ocultos">
            <TD>
                <label>Control Number:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].controlNumber" id="controlNumberCell1" theme="simple" value="%{safetydocs.envioses[1].controlNumber}" cssClass="req" />
            </TD>
        </TR>
        <TR id="docTypeCell1versionDate" class="ocultos">
            <TD>
                <label>Version Date:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].versionDate" id="versionDateCell1" theme="simple" value="%{safetydocs.envioses[1].versionDate}" cssClass="datepickerReq"/>
            </TD>
        </TR>
        <TR id="docTypeCell1cutoffDate" class="ocultos">
            <TD>
                <label>Cutoff Date:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].cutoffDate" id="cutoffDateCell1" theme="simple" value="%{safetydocs.envioses[1].cutoffDate}" cssClass="datepickerReq"/>
            </TD>
        </TR>
        <TR id="docTypeCell1replaceNumber" class="ocultos">
            <TD>
                <label>Replace Prev. Version Number:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].replaceNumber" id="replaceNumberCell1" theme="simple" value="%{safetydocs.envioses[1].replaceNumber}"/>
            </TD>
        </TR>
        <TR id="docTypeCell1replaceDate" class="ocultos">
            <TD>
                <label>Replace Prev. Version Date:</label>
            </td>
            <td>
                <s:textfield name="safetydocs.envioses[1].replaceDate" id="replaceDateCell1" theme="simple" value="%{safetydocs.envioses[1].replaceDate}" cssClass="datepicker"/>
            </TD>
        </TR>
        <TR id="docComment1">
            <TD>
                <label>Document comment:</label>
            </td>
            <td>
                <s:textarea name="safetydocs.envioses[1].comment" id="docCommentCell1" theme="simple" value="%{safetydocs.envioses[1].comment}" style="height: 80px"/>
            </TD>
        </TR>
        <TR id="docAttachment1">
            <TD>
                <label>Attach document:</label>
            </td>
            <td>
                <s:file name="files" id="docAttachmentCell1" theme="simple" cssClass="req"></s:file>
            </TD>
        </TR>
        <TR id="1" class="trEspacioAbajo">
            <td>
                <s:hidden></s:hidden>
            </td>
            <td id="cell1" align="right"><a style="text-align: right" onclick="removeDoc('table_docs',$(this).closest('tr'))"><img src="<s:url value="/images/delete2.png"/>" alt="Delete Document"></a></td>
        </TR>

        <tr>
          <th>
              <s:hidden></s:hidden>
          </th>
          <th align="right"><a onclick="addDoc('table_docs');updateDatepickers()"><img src="<s:url value="/images/add2.png"/>" alt="Add Document"></a></th>
        </tr>

        <s:url var="url" action="findMails"  namespace="/"/>
    <s:hidden id="receptores"/>
    </table>
        </div>
        </div>
        </td>
    </tr>

    <tr>
        <td colspan="2" class="centeredButtons" ><button value="Send" id="botonAceptar" onclick="return validate('<s:property value="%{#url}"/>');" theme="simple">Send</button>
        </td>
    </tr>


</s:form>

<script type="text/javascript">
    var ids=new Array();
    ids[0] =  ["attachments-show-hide",true];
    loadCollapse(ids);
</script>

<script type="text/javascript">
    $('#sendDocuments').css({"color":"#EE5102","fontWeight":"bold"});
</script>
